<?php

namespace App\Logics;

use App\Service\Dir;

class CacheLogic extends Logic
{

    // 缓存

    // 执行的命令
    public function clear()
    {
        $paths = $this->getCachePath();
        $dir   = new Dir();
        foreach($paths as $path){
            $path = storage_path($path);
            $dir->delDir($path, false);
        }

        return true;
    }


    // 获取可以删除的缓存路径
    protected function getCachePath()
    {
        // storage_path('logs/laravel.log')
        // $path = Config::get('cache.stores.file.path');
        //  'framework/cache/data' 不要删除 这里含有app_key
        $paths = [
            'logs/',
            'framework/bang.list',
            'framework/bang.show',
            'framework/field',
            'framework/model',
            'framework/logic',
            'framework/response',
            'framework/table',
            'framework/views',
        ];

        return $paths;
    }

}

